<?xml version="1.0" encoding="UTF-8"?>
<!-- =================================================================
 |
 | Stylesheet list all devices in a library giving each device unique
 | number. Device with same characteristics has the same number.
 |
 | Generate uniqe number could have a prefix given as a parameter in
 | command line (saxon *.xml list-dev.xsl prefix=XXXX).
 |
 | This stylesheet use dirty workaround regarding "counter" variable.
 | Canging variable value is not supported by XSL or XPATH standard 1.0,
 | therefore xmlns:saxon namespace is used.
 |
 +   ================================================================= -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:saxon="http://icl.com/saxon"
                extension-element-prefixes="saxon"
                version="3.0">

<xsl:output method="text"/>

<xsl:strip-space elements="*"/>

<!--
<xsl:template match="node()|@*">
   <xsl:copy>
      <xsl:apply-templates select="node()|@*"/>
   </xsl:copy>
</xsl:template>
-->

<!-- ================================================================
 |
 + ================================================================== -->
<xsl:template match="/">
   <xsl:call-template name="root.messages"/>
   <xsl:apply-templates/>
</xsl:template>

<!-- ================================================================
 |
 + ================================================================== -->
<xsl:template name="root.messages">
   <xsl:message>============================================================</xsl:message>
   <xsl:message> List of all devices in library                             </xsl:message>
   <xsl:message>                                                            </xsl:message>
   <xsl:message> AUTHOR : martin.sveda@saabgroup.com                        </xsl:message>
   <xsl:message> USING  :<xsl:value-of select="system-property('xsl:vendor')"/></xsl:message>
   <xsl:message>============================================================</xsl:message>
   <xsl:message>                                                            </xsl:message>
</xsl:template>


<xsl:template match="/eagle/drawing/library/devicesets/deviceset/devices/device/technologies">
   <xsl:for-each select="technology">
      <xsl:value-of select="attribute[@name='SAAB']/@value"/><xsl:text>;</xsl:text>
      <xsl:value-of select="attribute[@name='COMPONENT_TITLE']/@value"/><xsl:text>, </xsl:text>
      <xsl:value-of select="attribute[@name='COMPONENT_PACKAGE']/@value"/><xsl:text>, </xsl:text>  
      <xsl:value-of select="attribute[@name='COMPONENT_VALUE']/@value"/><xsl:text>, </xsl:text>
      <xsl:value-of select="attribute[@name='NOTE']/@value"/>
      <xsl:text>&#xa;</xsl:text>
   </xsl:for-each>
</xsl:template>

<xsl:template match="//description">
<xsl:text></xsl:text>
</xsl:template>

<xsl:template match="//symbol">
<xsl:text></xsl:text>
</xsl:template>



</xsl:stylesheet> 
